package com.shudingke.test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class B extends Thread{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String a = br.readLine();
        String s1 = s.toUpperCase();
        String a1 = a.toUpperCase();
        int index = 0;
        for (int i = 0; i < s1.length(); i++){
            if (a1.charAt(0) == s1.charAt(i)){
                index++;
            }
        }
        System.out.println(index);
        
    }
}
